-
Notifications
You must be signed in to change notification settings - Fork 7.9k
ext/pgsql: pgsql_copy_from to support iterable. #16124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
inspired from the Pdo\Pgsql new feature phpGH-15893.
7dd144c
to
1eef6df
Compare
ext/pgsql/pgsql.c
Outdated
@@ -3376,7 +3400,7 @@ PHP_FUNCTION(pg_copy_from) | |||
ZEND_PARSE_PARAMETERS_START(3, 5) | |||
Z_PARAM_OBJECT_OF_CLASS(pgsql_link, pgsql_link_ce) | |||
Z_PARAM_PATH_STR(table_name) | |||
Z_PARAM_ARRAY(pg_rows) | |||
Z_PARAM_ARRAY_OR_OBJECT(pg_rows) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use Z_PARAM_ITERABLE
ext/pgsql/pgsql.c
Outdated
} | ||
} ZEND_HASH_FOREACH_END(); | ||
} else { | ||
zend_object_iterator *iter = Z_OBJ_P(pg_rows)->ce->get_iterator(Z_OBJCE_P(pg_rows), pg_rows, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
zend_object_iterator *iter = Z_OBJ_P(pg_rows)->ce->get_iterator(Z_OBJCE_P(pg_rows), pg_rows, 0); | |
zend_object_iterator *iter = Z_OBJCE_P(pg_rows)->get_iterator(Z_OBJCE_P(pg_rows), pg_rows, 0); |
ext/pgsql/pgsql.stub.php
Outdated
@@ -847,7 +847,7 @@ function pg_put_line($connection, string $query = UNKNOWN): bool {} | |||
*/ | |||
function pg_copy_to(PgSql\Connection $connection, string $table_name, string $separator = "\t", string $null_as = "\\\\N"): array|false {} | |||
|
|||
function pg_copy_from(PgSql\Connection $connection, string $table_name, array $rows, string $separator = "\t", string $null_as = "\\\\N"): bool {} | |||
function pg_copy_from(PgSql\Connection $connection, string $table_name, array|object $rows, string $separator = "\t", string $null_as = "\\\\N"): bool {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function pg_copy_from(PgSql\Connection $connection, string $table_name, array|object $rows, string $separator = "\t", string $null_as = "\\\\N"): bool {} | |
function pg_copy_from(PgSql\Connection $connection, string $table_name, array|Traversable $rows, string $separator = "\t", string $null_as = "\\\\N"): bool {} |
The changes will need to be applied to #15893 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MSTM
inspired from the Pdo\Pgsql new feature phpGH-15893. close phpGH-16124
inspired from the Pdo\Pgsql new feature phpGH-15893. close phpGH-16124
inspired from the Pdo\Pgsql new feature GH-15893.